package com.pcitc.app.service;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.pcitc.app.dao.TblUserDao;
import com.pcitc.app.model.TblUser;
import com.pcitc.app.model.TblOrg;

public interface TblUserManager extends UniversalManager{
	
	/**
	 * @author zhangbin
	 * TblUserDao
	 * @param tblUserDao
	 */
	void setTblUserDao(TblUserDao tblUserDao);
	
	/**
	 * @author zhangbin
	 * 根据用户名查找用户
	 * @param username
	 * @return
	 */
    @Transactional
    TblUser loadUserByUsername(String username);
    
    /**
     * @author zhangbin
     * 根据用户ID查找用户
     * @param userid
     * @return
     */
    TblUser loadUserByUserId(Long userid);
    
    /**
     * @author zhangbin
     * 根据USER超找用户
     * @param tblUser
     * @return
     */
    List<TblUser> findByExample(TblUser tblUser);
    
    /**
     * @author zhangbin
     * 获取用户列表
     * @return
     */
    List<TblUser> getUserList();
    
    /**
     * @author zhangbin
     * 获取用户列表
     * @return
     */
    List<TblOrg> getOrgList();
    /**
     * @author zhangbin
     * 保存用户
     * @param tblUser
     * @return
     */
    void saveUser(TblUser tblUser);
    
    /**
     * @author zhangbin
     * 更新用户
     * @param tblUser
     * @return
     */
    TblUser upateUser(TblUser tblUser);
    
    /**
     * @author zhangbin
     * 删除用户
     * @param tblUser
     */
    void removeUser(TblUser tblUser);
    
    /**
     * @author zhangbin
     * 根据用户ID删除用户
     * @param userid
     */
    void removeUserByID(Long userid);
    
    /**
     * @author zhangbin
     *  删除所有
     * @param tblUsers
     */
    void removeAll(List<TblUser> tblUsers);
    
    /**
     * @author zhangbin
     * 检查用户名密码 返回USER
     * @param userName
     * @param pwd
     * @return
     */ 
    TblUser checkUserPassword(String userName, String pwd);
    
    
    /**
     * @author zhangbin
     * 检查用户名密码 返回Boolea值ֵ
     * @param userName
     * @param pwd
     * @return
     */
    boolean isValidUser(String userName, String pwd);
    
    /**
     * @author zhangbin
     * 检查用户ID是否存在 返回Booleanֵ值
     * @param userid
     * @return
     */
    boolean checkUserId(Long userid);
    
    /**
     * @author zhangbin
     * 修改用户密码
     * @param userId
     * @param oldPwd
     * @param newPwd
     * @return
     */
    boolean changePwd(Long userId,String oldPwd, String newPwd);
    
    /**
     * @author zhangbin
     * 获取用户密码
     * @param username
     * @return
     */
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    String getUserPassword(String username);
}
